" some keymap defined


function! CleverTab()
	if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
		return "\<Tab>"
	else
		return "\<C-N>"
	endif
endfunction
inoremap <Tab> <C-R>=CleverTab()<CR>

" window switch
" nnoremap <leader>c  :q<CR>
nnoremap <leader>w  <C-W><C-K>
nnoremap <leader>s  <C-W><C-J>
nnoremap <leader>a  <C-W><C-h>
nnoremap <leader>d  <C-W><C-l>
nnoremap <leader>-  :sp<CR>
nnoremap <leader>\  :vs<CR>

" file tab switch
nnoremap <silent> bl :ls<CR>   " normal 模式下使用 bl 列出 Buffer 列表
nnoremap <silent> bo :enew<CR> " normal 模式下使用 bo 打开一个新 Buffer
nnoremap <silent> bn :bnext<CR>     " normal 模式下使用 bn 切换到下一个 Buffer
nnoremap <silent> bp :bprevious<CR> " normal 模式下使用 bn 切换到上一个 Buffer
nnoremap <silent> bc :bdelete<CR>   " normal 模式下使用 bc 关闭当前 Buffer

" move to beginning/end of line
nnoremap B ^
nnoremap E $
nnoremap ,<space> :nohlsearch<CR>      " ,<space> to close search hilight


" F10 显示可打印字符开关
nnoremap <F10> :set list! list?<CR>
set pastetoggle=<F4>


" highligh keyword keymap
nmap  <silent> <F8> <leader>m
nmap  <silent> <F7> <leader>#  "<Plug>IgnoreMarkSearchPrev
nmap  <silent> <F9> <leader>*  "<Plug>IgnoreMarkSearchNext

" nertree and tagbar view
noremap <silent> <f12> :NERDTreeToggle<CR> :wincmd j <cr> :TagbarToggle<CR> :wincmd l <cr>
noremap <silent> <c-o> :NERDTreeFocus<CR>
noremap <silent> <c-l> :TagbarOpen j <cr>

" position jump
nmap <silent> <c-g> :call GotoJump()<CR>

" function jump , eg to define declear
" <c-]> jump to function define
" <c-T> jump to function call

" functiom and word grep
map <F11> :execute " grep -srnw --binary-files=without-match --exclude-dir=.git . -e " . expand("<cword>") . " " <bar> cwindow<CR>





